package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;

public class IteratorDemo {
    public static void main(String[] args) {
        Collection<String> c = new ArrayList();
        Collections.addAll(c, "*", "1", "*", "4", "*", "7");
        for (String s : c) {
            System.out.print(s + "\t");
        }
        System.out.println();
        Iterator it = c.iterator();
        while (it.hasNext()) {
            String next = (String) it.next();
            if (next.equals("*")) {
                it.remove();
            }
        }
        System.out.println(c);
    }
}
